#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int arr[10] = { 3,9,10,6,1,8,2,5,7,4 };
	int n = 10;
	int min = arr[0], max = arr[0];
	for (int i = 1;i < n;i++)
	{
		if (arr[i] > max)
		{
			max = arr[i];
		}
		if (arr[i] < min)
		{
			min = arr[i];
		}
	}
	int range = max - min + 1;
	int*count = (int*)calloc(range, sizeof(int));
	if (count==NULL)
	{
		perror("calloc::");
		return 0;
	}
	for (int i = 0;i < n;i++)
	{
		count[max - arr[i]]++;
	}

	for (int i = 0;i < range;i++)
	{
		while (count[i])
		{
			printf("%d ", min+i);
			count[i]--;
		}
	}
	printf("\n");
	return 0;
}